<?php
$this->title = '操作提示';
?>
<?php $this->beginBlock('content-header'); ?>
<span class="glyphicon <?= $type == 'success' ? 'glyphicon-ok-sign' : 'glyphicon-info-sign' ?>"
      style="color: #<?= $type == 'success' ? '00a65a' : 'dd4b39' ?>"></span> 操作提示
<?php $this->endBlock(); ?>
<div class="alert alert-<?= $type == 'success' ? 'success' : 'danger' ?>" role="alert">
    <strong><?= $message ?></strong>
    <div>
        <a href="<?= $url ?>">点击这里跳转</a>&nbsp;&nbsp;
        或 <b id="tips-cut-time" style="font-size: 18px;">3</b> 秒后系统自动跳转
    </div>
</div>
<?php
$script = <<<JS
    var url = "$url";
    var t;
    function delayURL() {
        var delay = document.getElementById("tips-cut-time").innerHTML;
        if(delay > 0){
            delay--;
            document.getElementById("tips-cut-time").innerHTML = delay;
		    t = setTimeout(delayURL, 1000);
        } else {
	        clearTimeout(t);
            window.location.href = url;
        }
    }
    delayURL();
JS;
$this->registerJs($script);
?>